function yyy = Calibrate_omega_function_old_weekend(zzz)

global w H_R H_M_target nu d_GIS ncity

omega=zzz;
d_GIS(:,26)=0; % home sector
H_M=zeros(26,1);
for a=2
    for d1=1:ncity % given residential choice
        % calculate sum
        sum_denominator=0;
        for d2=1:ncity+1
            sum_denominator=sum_denominator+omega(d2)/exp(nu(1,2)*d_GIS(d1,d2));
        end
        for d2=1:ncity+1
            new_matrix(d1,d2)=(omega(d2)/exp(nu(1,2)*d_GIS(d1,d2)))/sum_denominator*H_R(d1,a);
        end
    end
    for d2=1:ncity+1
        for d1=1:ncity
            H_M(d2)=H_M(d2)+new_matrix(d1,d2);
        end
    end
end

yyy = sum(abs((H_M-H_M_target(:,4))./H_M_target(:,4)));
yyy
end
